pub fn reset_password(&self, admin_id: ID, name: String, email: String) -> Result<()> {
        use crate::schema::reset_password_admins::dsl;

        let expiration = Some(util::now() + chrono::Duration::days(1));
        let token = &token::generate_token();
        let new_entry = NewResetPasswordKey {
            admin_id,
            token,
            expiration,
        };

        debug!("reset password token: {}", token);

        diesel::insert_into(reset_password_admins::table)
            .values(&new_entry)
            .on_conflict(dsl::admin_id)
            .do_update()
            .set(&new_entry)
            .execute(self.db)?;

        Ok(())
    }
/// Request token untuk reset password.
Request token untuk reset password.
Request token untuk reset password .
pub fn reset_password(&self, admin_id: ID, name: String, email: String) -> Result<()> {
        use crate::schema::reset_password_admins::dsl;
        let expiration = Some(util::now() + chrono::Duration::days(1));
        let token = &token::generate_token();
        let new_entry = NewResetPasswordKey {
            admin_id,
            token,
            expiration,
        };
        debug!("reset password token: {}", token);
        diesel::insert_into(reset_password_admins::table)
            .values(&new_entry)
            .on_conflict(dsl::admin_id)
            .do_update()
            .set(&new_entry)
            .execute(self.db)?;
        Ok(())
    }
pub fn reset_password ( & self , admin_id : ID , name : String , email : String ) -> Result < ( ) > { use crate :: schema :: reset_password_admins :: dsl ; let expiration = Some ( util :: now ( ) + chrono :: Duration :: days ( 1 ) ) ; let token = & token :: generate_token ( ) ; let new_entry = NewResetPasswordKey { admin_id , token , expiration , } ; debug ! ( " " token ) ; diesel :: insert_into ( reset_password_admins :: table ) . values ( & new_entry ) . on_conflict ( dsl :: admin_id ) . do_update ( ) . set ( & new_entry ) . execute ( self . db ) ? ; Ok ( ( ) ) }
Request token untuk reset password.
Request token untuk reset password .
&self
admin_id
ID
name
String
email
String
&self
admin_id
ID
name
String
email
String