Ejemplo n.º 1
0
def update_profile(account_from_user):
    print("What would you like to edit:")
    print("> 1. First Name")
    print("> 2. Last Name")
    print("> 3. Email")
    print("> 4. Delete Account")
    option = int(input("> "))
    loading.load()
    if option == 1:
        first_name = input("What would you like to change your first name to?")
        sql.update.update_fname(account_from_user, first_name)
        print(f"Your new First name is : {first_name}")
    elif option == 2:
        last_name = input("What would you like to change your last name to?")
        sql.update.update_fname(account_from_user, last_name)
        print(f"Your new last name is : {last_name}")
    elif option == 3:
        email = input("What would you like to change your email to?")
        sql.update.update_fname(account_from_user, email)
        print(f"Your new First name is : {email}")
    elif option == 4:
        loading.load()
        sql.delete_user(account_from_user)
    else:
        print("Invalid option")
        update_profile(account_from_user)
Ejemplo n.º 2
0
async def delete_user(username: str,
                      super_authen: str = Depends(super_authen)):
    '''Quản lý các tài khoản'''
    data = {'username': username}
    rowcount = sql.delete_user(data)
    if rowcount >= 1:
        return {'deleted_username': username}
    else:
        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND,
                            detail="username doesnt exist")
Ejemplo n.º 3
0
def choose():
    inputs = ui.get_inputs(["Please enter a number: "], "")
    option = inputs[0]
    if option == "1":
        sql.name_of_mentors()
    elif option == "2":
        sql.nickname_of_mentors_from_miskolc()
    elif option == "3":
        sql.information_from_carol()
    elif option == "4":
        sql.information_from_unknown_girl()
    elif option == "5":
        sql.add_new_applicant()
    elif option == "6":
        sql.change_phonenumber()
    elif option == "7":
        sql.delete_user()
    elif option == "0":
        sys.exit(0)
    else:
        raise KeyError("There is no such option.")
    async def register_users(self, ctx):
        for member in self.bot.users:
            sql.delete_user(member.id)

        for member in self.bot.users:
            sql.register_user(member.id, member.name)
Ejemplo n.º 5
0
				template = template.render(users=sql.select_users(user=new_user),
											groups=sql.select_groups(),
											page=page,
											roles=sql.select_roles())
				print(template)
				funct.logging('a new user '+new_user, ' has created ', haproxywi=1, login=1)
		else:
			funct.logging(new_user, ' tried to privilege escalation', haproxywi=1, login=1)
			
			
if form.getvalue('userdel') is not None:
	userdel = form.getvalue('userdel')
	user = sql.select_users(id=userdel)
	for u in user:
		username = u[1]
	if sql.delete_user(userdel):
		funct.logging(username, ' has deleted user ', haproxywi=1, login=1)
		print("Ok")
		
		
if form.getvalue('updateuser') is not None:
	email = form.getvalue('email')
	role = form.getvalue('role')
	group = form.getvalue('usergroup')
	new_user = form.getvalue('updateuser')	
	id = form.getvalue('id')	
	activeuser = form.getvalue('activeuser')	
	role_id = sql.get_role_id_by_name(role)
	
	if sql.check_group(group, role_id):			
		if funct.is_admin(level=role_id):