Skip to content

Commit

Permalink
在安装时增加用户自己填写密码的功能
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqi committed Oct 21, 2013
1 parent c3ae117 commit 96a5c07
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
8 changes: 7 additions & 1 deletion install.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function _u()
'ip' => '127.0.0.1', 'agent' => $options->generator, 'text' => '欢迎加入 Typecho 大家族', 'type' => 'comment', 'status' => 'approved', 'parent' => 0)));

/** 初始用户 */
$password = substr(uniqid(), 7);
$password = empty($config['userPassword']) ? substr(uniqid(), 7) : $config['userPassword'];

$installDb->query($installDb->insert('table.users')->rows(array('name' => $config['userName'], 'password' => Typecho_Common::hash($password), 'mail' => $config['userMail'],
'url' => 'http://www.typecho.org', 'screenName' => $config['userName'], 'group' => 'administrator', 'created' => Typecho_Date::gmtTime())));
Expand Down Expand Up @@ -463,6 +463,7 @@ function _u()
Typecho_Cookie::set('__typecho_config', base64_encode(serialize(array_merge(array(
'prefix' => _r('dbPrefix'),
'userName' => _r('userName'),
'userPassword' => _r('userPassword'),
'userMail' => _r('userMail'),
'adapter' => $adapter,
'siteUrl' => _r('userUrl')
Expand Down Expand Up @@ -546,6 +547,11 @@ function _u()
<p class="description"><?php _e('请填写您的用户名'); ?></p>
</li>
<li>
<label class="typecho-label" for="userPassword"><?php _e('登录密码'); ?></label>
<input type="password" name="userPassword" id="userPassword" class="text" value="<?php _v('userPassword'); ?>" />
<p class="description"><?php _e('请填写您的登录密码, 如果留空系统将为您随机生成一个'); ?></p>
</li>
<li>
<label class="typecho-label" for="userMail"><?php _e('邮件地址'); ?></label>
<input type="text" name="userMail" id="userMail" class="text" value="<?php _v('userMail', '[email protected]'); ?>" />
<p class="description"><?php _e('请填写一个您的常用邮箱'); ?></p>
Expand Down
4 changes: 2 additions & 2 deletions install/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<h3 class="warning"><?php _e('系统将为您自动匹配 %s 环境的安装选项', 'BAE'); ?></h3>
<li>
<label class="typecho-label" for="dbDatabase"><?php _e('数据库名'); ?></label>
<input type="text" class="text" id="dbDatabase" name="dbDatabase" value="<?php _v('dbDatabase', 'typecho'); ?>" />
<p class="description"><?php _e('请您指定数据库名称'); ?></p>
<input type="text" class="text" id="dbDatabase" name="dbDatabase" value="<?php _v('dbDatabase'); ?>" />
<p class="description"><?php _e('可以在MySQL服务的管理页面看到您创建的数据库名称'); ?></p>
</li>
<input type="hidden" name="config" value="array (
'host' => getenv('HTTP_BAE_ENV_ADDR_SQL_IP'),
Expand Down
8 changes: 6 additions & 2 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ update:

package:
@echo 'package'
rm -Rf build/mockup/
rm -Rf build/tools/
rm -Rf build/todo.txt
rm -Rf build/usr/plugins/*
Expand Down Expand Up @@ -62,7 +61,12 @@ install:
make update
rm -Rf build/tools/
rm -Rf build/todo.txt
rm -Rf ${DIR}/usr/plugins/*
rm -Rf build/usr/plugins/*
rm -Rf build/admin/scss
rm -Rf build/admin/img/editor
rm -Rf build/admin/img/icons
mkdir build/usr/uploads/
chmod 777 build/usr/uploads/
cp -Rf build/* ${DIR}
make clear

Expand Down

0 comments on commit 96a5c07

Please sign in to comment.