当前位置: 首页 > 工具软件 > Gitorious > 使用案例 >

gitorious 重置帐户密码,bitnami 安装

左恺
2023-12-01

进入安装目录 /opt/gitorious-3.2.0-1/apps/gitorious/htdocs/bin 复制一份 create-user 脚本并命名为 reset-password

cd /opt/gitorious-3.2.0-1/apps/gitorious/htdocs/bin
cp create-user reset-password

编辑 reset-password 脚本,修改后内容如下:

#!/opt/gitorious-3.2.0-1/ruby/bin/ruby
require(File.expand_path(File.dirname(__FILE__) + "/setup"))

def yes_no(str)
  str == "y"
end

Gitorious::CLI.new.run_with_gitorious_environment do
  require "./config/environment"
  require "highline/import"

  ActionMailer::Base.raise_delivery_errors = false
  ActionMailer::Base.delivery_method = :test

  if ARGV.empty?
    login = ask("Enter login name:  ")
    password = ask("Enter password: ") { |q| q.echo = "*" }
  else
    login, password = ARGV
  end

  user = User.find_by_login(login)
  user.password = password
  user.password_confirmation = password
  user.save()
end
保存后,使用方法:

./reset-password username passwd
或不带参数执行
./reset-password
=>Enter login name: username
=>Enter password: ******
=>



 类似资料: