public async Task<SetMobilePasswordOutput> SetMobilePassword(SetMobilePasswordInput input) { SetMobilePasswordOutput result = await this._userBll.SetMobilePassword(input); if (result.Status == 0) await this.LogHistory(LoginType.ChangePassword, LoginStatus.Success, this.User.Identity.GetUserName(), input.Mobile, (string)null, (string)null); else await this.LogHistory(LoginType.ChangePassword, LoginStatus.BadRequest, this.User.Identity.GetUserName(), input.Mobile, (string)null, (string)null); return result; }
public async Task<SetMobilePasswordOutput> SetMobilePassword(SetMobilePasswordInput input) { SetMobilePasswordOutput output = new SetMobilePasswordOutput() { Status = 1 }; ApplicationUser currentUser = await this.UserManager.FindByNameAsync(input.Mobile); if (currentUser != null && currentUser.Id > 0) { string password = this.GeneratePassword(6); IdentityResult res = await this.UserManager.AddPasswordAsync(currentUser.Id, password); if (res.Succeeded) { output.Status = 0; output.MobileMsg = string.Format(ConfigurationManager.AppSettings["SmsMsgMkErrorSuccess"], (object)password); } else output.MobileMsg = ConfigurationManager.AppSettings["SmsMsgMkErrorUnknown"]; } else output.MobileMsg = ConfigurationManager.AppSettings["SmsMsgMkErrorNotExist"]; return output; }