diff --git a/core/js/lostpassword.js b/core/js/lostpassword.js
new file mode 100644
index 0000000000..00dfe71be6
--- /dev/null
+++ b/core/js/lostpassword.js
@@ -0,0 +1,134 @@
+
+OC.Lostpassword = {
+ sendErrorMsg : t('core', 'Couldn’t send reset email. Please contact your administrator.'),
+
+ sendSuccessMsg : t('core', 'The link to reset your password has been sent to your email. If you do not receive it within a reasonable amount of time, check your spam/junk folders. If it is not there ask your local administrator.'),
+
+ encryptedMsg : t('core', "Your files are encrypted. If you haven't enabled the recovery key, there will be no way to get your data back after your password is reset. If you are not sure what to do, please contact your administrator before you continue. Do you really want to continue?")
+ + (' ')
+ + ' '
+ + ''
+ + t('core', 'Reset password')
+ + '',
+
+ resetErrorMsg : t('core', 'Password can not be changed. Please contact your administrator.'),
+
+ init : function() {
+ if ($('#lost-password-encryption').length){
+ $('#lost-password-encryption').click(OC.Lostpassword.sendLink);
+ } else {
+ $('#lost-password').click(OC.Lostpassword.sendLink);
+ }
+ $('#reset-password #submit').click(OC.Lostpassword.resetPassword);
+ },
+
+ sendLink : function(event){
+ event.preventDefault();
+ if (!$('#user').val().length){
+ $('#submit').trigger('click');
+ } else {
+ $.post(
+ OC.filePath('core', 'ajax', 'password/lost'),
+ {
+ user : $('#user').val(),
+ proceed: $('#encrypted-continue').attr('checked') ? 'Yes' : 'No'
+ },
+ OC.Lostpassword.sendLinkDone
+ );
+ }
+ },
+
+ sendLinkDone : function(result){
+ if (result && result.status === 'success'){
+ OC.Lostpassword.sendLinkSuccess();
+ } else {
+ if (result && result.msg){
+ var sendErrorMsg = result.msg;
+ } else if (result && result.encryption) {
+ var sendErrorMsg = OC.Lostpassword.encryptedMsg;
+ } else {
+ var sendErrorMsg = OC.Lostpassword.sendErrorMsg;
+ }
+ OC.Lostpassword.sendLinkError(sendErrorMsg);
+ }
+ },
+
+ sendLinkSuccess : function(msg){
+ var node = OC.Lostpassword.getSendStatusNode();
+ node.addClass('success').css({width:'auto'});
+ node.html(OC.Lostpassword.sendSuccessMsg);
+ },
+
+ sendLinkError : function(msg){
+ var node = OC.Lostpassword.getSendStatusNode();
+ node.addClass('warning');
+ node.html(msg);
+ OC.Lostpassword.init();
+ },
+
+ getSendStatusNode : function(){
+ if (!$('#lost-password').length){
+ $('