diff --git a/app/views/keys/new.html.haml b/app/views/keys/new.html.haml index 743a3173..277936c6 100644 --- a/app/views/keys/new.html.haml +++ b/app/views/keys/new.html.haml @@ -1,3 +1,14 @@ %h3 New key %hr = render 'form' + +:javascript + $('#key_key').on('keyup', function(){ + var title = $('#key_title'), + val = $('#key_key').val(), + key_mail = val.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+|\.[a-zA-Z0-9._-]+)/gi); + + if( key_mail && key_mail.length > 0 && title.val() == '' ){ + $('#key_title').val( key_mail ); + } + }); \ No newline at end of file